///* USER CODE BEGIN Header */
///**
//  ******************************************************************************
//  * @file    can.c
//  * @brief   This file provides code for the configuration
//  *          of the CAN instances.
//  ******************************************************************************
//  * @attention
//  *
//  * Copyright (c) 2022 STMicroelectronics.
//  * All rights reserved.
//  *
//  * This software is licensed under terms that can be found in the LICENSE file
//  * in the root directory of this software component.
//  * If no LICENSE file comes with this software, it is provided AS-IS.
//  *
//  ******************************************************************************
//  */
///* USER CODE END Header */
///* Includes ------------------------------------------------------------------*/
#include "can_driver.h"


can_receive_message_struct receive_message;
can_trasnmit_message_struct transmit_message;



//void CAN_bps_config(uint8_t CAN_bps)
//{
//	switch(CAN_bps)
//	{
//		case 0://500K
//			hcan1.Instance = CAN1;
//			hcan1.Init.Prescaler = 9;
//			hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
//			hcan1.Init.TimeSeg1 = CAN_BS1_6TQ;
//			hcan1.Init.TimeSeg2 = CAN_BS2_3TQ;
//			if (HAL_CAN_Init(&hcan1) != HAL_OK)
//			{
//				Error_Handler();
//			}
//			break;
//		case 1://1M
//			hcan1.Instance = CAN1;
//			hcan1.Init.Prescaler = 9;
//			hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
//			hcan1.Init.TimeSeg1 = CAN_BS1_3TQ;
//			hcan1.Init.TimeSeg2 = CAN_BS2_1TQ;
//			if (HAL_CAN_Init(&hcan1) != HAL_OK)
//			{
//				Error_Handler();
//			}		
//			break;
//		case 2://250K
//			hcan1.Instance = CAN1;
//			hcan1.Init.Prescaler = 9;
//			hcan1.Init.SyncJumpWidth = CAN_SJW_1TQ;
//			hcan1.Init.TimeSeg1 = CAN_BS1_13TQ;
//			hcan1.Init.TimeSeg2 = CAN_BS2_6TQ;
//			if (HAL_CAN_Init(&hcan1) != HAL_OK)
//			{
//				Error_Handler();
//			}			
//			break;
//	}
//}
